<template>
  <div class="app-container">
    <el-card style="width: 50%;">
      <div slot="header">
        <span>数据恢复</span>
      </div>
      <el-form label-width="100px">
        <el-form-item label="主机" prop="host">
          <el-input v-model="form.host" readonly></el-input>
        </el-form-item>
        <el-form-item label="端口" prop="port">
          <el-input v-model="form.port" readonly></el-input>
        </el-form-item>
        <el-form-item label="数据库账号" prop="username">
          <el-input v-model="form.username" readonly></el-input>
        </el-form-item>
        <el-form-item label="数据库密码" prop="password">
          <el-input v-model="form.password" show-password readonly></el-input>
        </el-form-item>
        <el-form-item label="数据库名" prop="dbname">
          <el-input v-model="form.dbname" readonly></el-input>
        </el-form-item>
        <el-form-item label="文件地址">
          <el-input type="file" v-model="form.fileName" v-on:change="handleFile"></el-input>
        </el-form-item>
      </el-form>
      <div style="text-align: center">
         <el-button type="primary" @click="recovery">恢复数据</el-button>
      </div>
    </el-card>
  </div>

</template>

<script>
import {recovery} from "@/api/gaoxin/dataManage";

export default {
  name: "recovery",
  data() {
    return {
      form: {
        host: "localhost",
        port: "3306",
        username: "root",
        password: "lsn123",
        dbname: "ruoyi-test",
        backupPath: "D:\\ruoyi\\mysqlBackup",
        fileName: '',
      },
      database: {},


    }
  },
  created() {
  },
  methods: {
    recovery() {
      recovery(this.form).then(res => {
        this.database = res.data;
        this.$modal.msgSuccess("恢复成功");
      })
    },
    handleFile() {
      const fileName = event.target.files[0].name;
      this.form.fileName = fileName;
    }
  }
}
</script>

<style scoped>

</style>
